<?php
namespace Admin\Controller;
class IndexController extends CommonController{
    public function index(){
        $Model = new \Admin\Model\transactionModel();

        $TodayPayMoney = $Model->daysPayMoney('Today');
        $YesterdayMoney = $Model->daysPayMoney('Yesterday');
        $Thismonth = $Model->daysPayMoney('thismonth');
        $WeekThisPaymoney = $Model->daysPayMoney('WeekThisPaymoney');
        $this->assign('SumPayMoney' , $Model->sumPayMoney());
        $this->assign('TodayPayMoney' , $TodayPayMoney); // 今天
        $this->assign('YesterdayMoney' , $YesterdayMoney); // 昨天
        $this->assign('Thismonth' , $Thismonth); // 本月的
        $this->assign('WeekThisPaymoney' , $WeekThisPaymoney);
        $this->assign('SumMoney' , IndexController::SumMoney($TodayPayMoney , $YesterdayMoney , $Thismonth , $WeekThisPaymoney)); // 合计流水
        $this->assign('current_Titlename' , '首页');
        $this->display('index');
    }

    /* 合计支付金额 */
    private static function SumMoney($TodayPayMoney , $YesterdayMoney , $Thismonth , $WeekThisPaymoney){
        $todaySum = $TodayPayMoney['qq_pay'] + $TodayPayMoney['alipay_pay'] + $TodayPayMoney['weixinGzh_pay'] + $TodayPayMoney['WeixinScancode'] + $TodayPayMoney['jd_pay'] + $TodayPayMoney['bank_pay']; // 今日总数
        $YesterdayMoney = $YesterdayMoney['qq_pay'] + $YesterdayMoney['alipay_pay'] + $YesterdayMoney['weixinGzh_pay'] + $YesterdayMoney['WeixinScancode'] + $YesterdayMoney['jd_pay'] + $YesterdayMoney['bank_pay'];
        $Thismonth = $Thismonth['qq_pay'] + $Thismonth['alipay_pay'] + $Thismonth['weixinGzh_pay'] + $Thismonth['WeixinScancode'] + $Thismonth['jd_pay'] + $Thismonth['bank_pay'];
        $WeekThisPaymoney = $WeekThisPaymoney['qq_pay'] + $WeekThisPaymoney['alipay_pay'] + $WeekThisPaymoney['weixinGzh_pay'] + $WeekThisPaymoney['WeixinScancode'] + $WeekThisPaymoney['jd_pay'] + $WeekThisPaymoney['bank_pay'];
        return array(
           'todaySum' => $todaySum,
           'YesterdayMoney' => $YesterdayMoney,
           'Thismonth' => $Thismonth,
           'WeekThisPaymoney' => $WeekThisPaymoney,
        );
    }


}